home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: 2005 Utilities
/
CHIP Utilities 2005.7z
/
CHIP Utilities 2005.iso
/
images
/
arachne.igz
/
arachne.img
/
LEVEL2
/
IDLE.CAB
/
Bin
/
Idle.bat
Wrap
DOS Batch File
|
2005-01-16
|
5KB
|
168 lines
@if "%debug%"=="" echo off
if "%1"==":" if not "%2"=="" goto %2
:: Idle Begin ::
if not exist %ramdrv%\bin\lmod.com %0 : _error missing lmod.com (check utils.%arcext%)
if not exist %ramdrv%\bin\tfind.com %0 : _error missing tfind.com (check utils.%arcext%)
if not exist %ramdrv%\bin\wbat.com %0 : _error missing wbat.com (check utils.%arcext%)
if not exist %ramdrv%\bin\varset.com %0 : _error missing varset.com (check utilz.%arcext%)
:_start
echo. >%tmp%\_idle.tmp
if not exist %ramdrv%\etc\global.set goto _noglob
type %ramdrv%\etc\global.set >%tmp%\_idle.tmp
:_noglob
if not exist %ramdrv%\etc\idle.set goto _nospec
type %ramdrv%\etc\idle.set >%tmp%\_idle.tmp
:_nospec
xgrep -sy "^[:s]*@*[:s]*s?e?t?[:s]*IDLE_.+=" %tmp%\_idle.tmp >%tmp%\_idle.bak
if errorlevel 1 goto _noset
xgrep -sy "^[:s]*@*[:s]*set[:s]+" %tmp%\_idle.bak >%tmp%\_idle.bat
xgrep -syv "^[:s]*@*[:s]*set[:s]+" %tmp%\_idle.bak >%tmp%\_idle.tmp
if errorlevel 1 goto _runset
lmod /L* set []<%tmp%\_idle.tmp >>%tmp%\_idle.bat
:_runset
call %tmp%\_idle.bat
:_noset
if "%idle_ti%"=="" set idle_ti=5
for %%i in (-c -C) do if "%1"=="%%i" goto _config
if "%1"=="/c" goto _config
if "%1"=="/C" goto _config
for %%i in (-h -H -?) do if "%1"=="%%i" goto _usage
if "%1"=="/h" goto _usage
if "%1"=="/H" goto _usage
if "%1"=="/?" goto _usage
if "%idle_ncfg%"=="1" goto _nocfg
set wcb1=%idle_dosbios%
call w.bat box @%0:w_cfg #2,%idle_ti%
if errorlevel 3 goto _end
set idle_dosbios=%wcb1%
if errorlevel 2 goto _config
:_nocfg
:_install
if "%idle_dosbios%"=="1" goto _dosbios
echo IDLE: FdApm not installed (no Power saving, no CPU Idle)
goto _end
:_dosbios
echo IDLE: Installing 'FdApm ADV:REG' (Both Dos and Bios saving mode on)
if exist %ramdrv%\bin\snap.com snap.com S=%tmp%\fdapm.bin >%tmp%\nul
fdapm adv:reg
if "%fd%"=="os" if not "%errorlevel%"=="1" echo %errorlevel%
if errorlevel 1 goto _ok
%0 : _error FdApm installation failed
goto _end
:_ok
if not "%idle_bios%"=="1" goto _stats
echo IDLE: Installing 'FdApm ApmBios' (Only Bios saving mode on)
fdapm apmbios
if "%fd%"=="os" if not "%errorlevel%"=="0" echo %errorlevel%
:_stats
fdapm stats
goto _end
:_config
echo :w_config "FdApm configuration" [x]>%tmp%\_idle.tmp
echo.>>%tmp%\_idle.tmp
echo Dialog timeout [$ idle_ti,3] seconds.>>%tmp%\_idle.tmp
echo [!] Skip "Run FdApm or go config?" dialog>>%tmp%\_idle.tmp
echo.>>%tmp%\_idle.tmp
echo [.] Install FdApm with Dos and Bios saving mode >>%tmp%\_idle.tmp
echo (for Power Saving and CPU Idle modes) >>%tmp%\_idle.tmp
echo [!] Turn off Dos saving mode >>%tmp%\_idle.tmp
echo (Leave only Bios saving activated) >>%tmp%\_idle.tmp
echo.>>%tmp%\_idle.tmp
echo [.] Do not install FdApm >>%tmp%\_idle.tmp
echo (No Power saving, no CPU Idle) >>%tmp%\_idle.tmp
echo.>>%tmp%\_idle.tmp
echo [ Save ] [? Cancel ]>>%tmp%\_idle.tmp
set wcb1=%idle_ncfg%
set wcb2=%idle_bios%
set wrb=%idle_dosbios%
if not "%idle_dosbios%"=="1" set wrb=2
call w.bat box @%tmp%\_idle.tmp:w_config
if errorlevel 2 goto _end
set idle_ncfg=%wcb1%
set idle_bios=%wcb2%
set idle_dosbios=%wrb%
if not "%wrb%"=="1" set idle_dosbios=0
set t_out=1
call drd.bat %srcdrv%
if errorlevel 1 set t_out=0
wbat box @%0:w_wprot #1,%t_out%
set t_out=
if errorlevel 2 goto _start
echo IDLE: Saving configuration...
set | tfind /f1,5 "IDLE_">%tmp%\_idle.bat
if not exist %srcdrv%\etc\*.* mkdir %srcdrv%\etc
if not exist %ramdrv%\etc\global.set goto _yglob
xgrep -syv "^[:s]*@*[:s]*s?e?t?[:s]*IDLE_.+=" %ramdrv%\etc\global.set >>%tmp%\_idle.bat
:_yglob
type %tmp%\_idle.bat >%srcdrv%\etc\global.set
type %tmp%\_idle.bat >%ramdrv%\etc\global.set
if exist %srcdrv%\etc\idle.set del %srcdrv%\etc\idle.set >%tmp%\nul
if exist %ramdrv%\etc\idle.set del %ramdrv%\etc\idle.set >%tmp%\nul
echo IDLE: Configuration saved to %srcdrv%\etc\global.set
echo.
goto _start
:w_cfg "Run FdApm or go config?" [x]
(~press any key~: #? sec.)
[!] Running FdApm ...
(Power Saving, CPU Idle)
[ Ok ] [ Config ] [? Abort ]
::
:w_wprot "Disable write protection..." [x]
If the disk in drive %srcdrv% is write
protected, please disable the write
protection now in order to save settings.
You can re-enable write protection after
saving.
[ Ok ] [? Cancel ]
::
:_usage
echo Parameters:
echo -c Config mode
echo -h This help info
echo.
goto _end
:_error
shift
shift
echo.
echo IDLE: Error%errorlevel% %1 %2 %3 %4 %5 %6 %7 %8
echo.
@rem pause
goto _end
:_abort
echo IDLE: Aborted...
echo.
@rem pause
:_end
set | tfind /f1,2 "W_" >%tmp%\_idle.tmp
set | tfind /f1,5 "IDLE_" >>%tmp%\_idle.tmp
type %tmp%\_idle.tmp | lmod /L* /B= set [$1]=>%tmp%\_idle.bat
call %tmp%\_idle.bat
if exist %tmp%\_idle.* del %tmp%\_idle.*
set ?=
set wcb1=
set wcb2=
set wcb3=
set wcb4=
set wcb5=
set wcb6=
set wcb7=
set wcb8=
set wcb9=
set wrb=
set wbat=
:: Idle End ::